import './App.scss'
import { Router, Route, Switch, Redirect } from 'react-router-dom'
import Layout from './pages/Layout'
import Login from './pages/Login'
import ProfileEdit from './pages/Profile/Edit'
import PrivateRoute from './components/PrivateRoute'
import history from './utils/history'
import Chat from './pages/Profile/Chat'
import Article from './pages/Article'
import Search from './pages/Search'
import SearchResult from './pages/Search/Result'
import KeeAlive from './components/KeepAlive'

function App() {
  return (
    <Router history={history}>
      <KeeAlive path="/home" activePath="/home">
        <Layout></Layout>
      </KeeAlive>
      <Switch>
        <Redirect exact from="/" to="/login"></Redirect>
        <Route path="/login" component={Login}></Route>

        {/* <Route path="/home" component={Layout}></Route> */}
        <Route path="/article/:id" component={Article}></Route>
        <Route exact path="/search" component={Search}></Route>
        <Route exact path="/search/result" component={SearchResult}></Route>

        <PrivateRoute
          path="/profile/edit"
          component={ProfileEdit}
        ></PrivateRoute>
        <PrivateRoute path="/chat" component={Chat}></PrivateRoute>
      </Switch>

      {/* <div className="app">123</div> */}
    </Router>
  )
}

export default App
